/**
 * Created on 25 dec. 2011 at 12:05:25 by HozakaN
 */
package fr.castorhoz.isi_connectivity_widget.mobiledata_widget;

import android.os.Build;
import android.util.Log;

/**
 * @author HozakaN
 *
 */
public class MobileDataSwitcherFactory {
	
	private static final boolean DEBUG_FULL_POST_FROYO = false;

	/**
	 * Give back a MobileDataSwitcher based on the current device android version
	 * We must do this since switching network state is not possible anymore after Froyo (Android 2.2, api level 8)
	 * @param version
	 * @return
	 */
	public static MobileDataSwitcher getMobileDataSwitcher(int version) {
		Log.d(MobileDataSwitcherFactory.class.getName(), "getting MobileDataSwitcher for device android version : "+version);
		
		MobileDataSwitcher switcher = null;
		
		if (DEBUG_FULL_POST_FROYO) {
			switcher = new MobileDataSwitcherPostFroyo();
		} else {
			if (version > Build.VERSION_CODES.FROYO) {
				switcher = new MobileDataSwitcherPostFroyo();
			} else {
				switcher = new MobileDataSwitcherFroyoAndPrevious();
			}
		}
		return switcher;
	}
}
